import {request} from '@umijs/max';
import * as API from "@/services";


/** 约稿 分页检索请求 */
export async function queryManuscriptInvitations(params: API.ManuscriptInvitationPageQueryParams): Promise<API.RespPageResult<API.ManuscriptInvitation>> {
  return request('/api/v1/invitation', {
    params,
  });
}

/** 约稿 详情请求 */
export async function queryManuscriptInvitation(bizId: API.EntityId): Promise<API.RespResult<API.ManuscriptInvitation>> {
  return request(`/api/v1/invitation/${bizId}`);
}

/** 约稿 创建请求 */
export async function createManuscriptInvitation(entity: API.ManuscriptInvitation_Create): Promise<API.RespResult<any>> {
  return request(`/api/v1/invitation`, {
    method: 'POST',
    data: entity,
  });
}

/** 约稿 修改请求 */
export async function modifyManuscriptInvitation(entity: API.ManuscriptInvitation_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/invitation/${entity.id}`, {
    method: 'PUT',
    data: entity,
  });
}

/** 约稿 修改(部分)请求 */
export async function patchManuscriptInvitation(entity: API.ManuscriptInvitation_Patch): Promise<API.RespResult<any>> {
  return request(`/api/v1/invitation/${entity.id}`, {
    method: 'PATCH',
    data: entity,
  });
}

/** 约稿 删除请求 */
export async function deleteManuscriptInvitation(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/invitation/${bizId}`, {
    method: 'DELETE',
  });
}

/** 约稿 批量删除请求 */
export async function deleteManuscriptInvitations(bizIds: API.EntityId[]): Promise<API.RespResult<any>> {
  return request(`/api/v1/invitation`, {
    method: 'DELETE',
    data: {
      ids: bizIds,
    },
  });
}
